home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / src / exampleCode / opengl / GLUT / lib / glut / glutint.ah < prev    next >
Encoding:
Text File  |  1996-11-11  |  40.1 KB  |  1,049 lines

  1. //tex
  2.  
  3. \section{Basic Data Structures: glutint.h}
  4. \label{iglut_glutint_h}
  5.  
  6. The {\tt glutint.h} header file declares GLUT internal data structures and internal
  7. functions and variables used across GLUT implementation source files.  This header
  8. is included by all the GLUT implementation source code.  Because it defines
  9. internal information about GLUT's implementation which is not part of the GLUT
  10. API, it should not be included by source files using the GLUT API.
  11.  
  12. The library uses the {\tt \_\_glut} prefix for all internal symbols
  13. (functions and variables) that might have external linkage.  Where
  14. internal symbols are isolated to a single source file, such symbols are
  15. declared static to avoid external linkage.  For such static symbols,
  16. the {\tt \_\_glut} prefix is unnecessary.  This convention sets up a
  17. clean namespace for GLUT internal symbols to avoid clashing with 
  18. application symbols.
  19.  
  20. //dead
  21. #ifndef __glutint_h__
  22. #define __glutint_h__
  23.  
  24. /* Copyright (c) Mark J. Kilgard, 1994. */
  25.  
  26. /* This program is freely distributable without licensing fees 
  27.    and is provided without guarantee or warrantee expressed or 
  28.    implied. This program is -not- in the public domain. */
  29.  
  30. #ifdef __sgi
  31. #define SUPPORT_FORTRAN
  32. #endif
  33. //tex
  34. Unix, X11, OpenGL, and GLX data types are used throughout this header.
  35.  
  36. //code
  37. #include <X11/Xlib.h>
  38. #include <GL/glx.h>
  39. #include <GL/glut.h>
  40. #ifdef __vms
  41. struct timeval {
  42.   __int64 val;
  43. };
  44. extern int sys$gettim(struct timeval *);
  45. #else
  46. #include <sys/types.h>
  47. #include <sys/time.h>
  48. #endif
  49. //tex
  50. \subsection{Time Management}
  51.  
  52. GLUT's {\tt glutTimerFunc} allows GLUT to generate callbacks in response
  53. to the passage of time.  The bulk of the code to manage timer callbacks
  54. is found in {\tt glut\_event.c}'s event processing code.  To manage time related
  55. calculations a number of time related macros are helpful.
  56.  
  57. {\tt GETTIMEOFDAY} is specified as a macro because the Berkeley Unix and AT\&T Unix
  58. variants have conflicting interfaces for {\tt gettimeofday}.  The BSD variant of
  59. {\tt gettimeofday} takes a second parameter to return timezone information
  60. (that is not used by GLUT).  Using {\tt GETTIMEOFDAY}
  61. helps hide this differences in the two interfaces.
  62.  
  63. //code
  64. #if defined(__vms)
  65.  
  66. /* One TICK on VMS is 100 nanoseconds; 0.1 microseconds or
  67.    0.0001 milliseconds. This means that there are 0.01
  68.    ticks/ns, 10 ticks/us, 10,000 ticks/ms and 10,000,000
  69.    ticks/second. */
  70.  
  71. #define TICKS_PER_MILLISECOND 10000
  72. #define TICKS_PER_SECOND      10000000
  73.  
  74. #define GETTIMEOFDAY(_x) (void) sys$gettim (_x);
  75.  
  76. #define ADD_TIME(dest, src1, src2) { \
  77.   (dest).val = (src1).val + (src2).val; \
  78. }
  79.  
  80. #define TIMEDELTA(dest, src1, src2) { \
  81.   (dest).val = (src1).val - (src2).val; \
  82. }
  83.  
  84. #define IS_AFTER(t1, t2) ((t2).val > (t1).val)
  85.  
  86. #define IS_AT_OR_AFTER(t1, t2) ((t2).val >= (t1).val)
  87.  
  88. #else
  89. #if defined(SVR4) && !defined(sun)  /* Sun claims SVR4, but wants 2 args. */
  90. #define GETTIMEOFDAY(_x) gettimeofday(_x)
  91. #else
  92. #define GETTIMEOFDAY(_x) gettimeofday(_x, (struct timezone*) NULL)
  93. #endif
  94. //tex
  95. \noindent
  96. The {\tt GETTIMEOFDAY} updates a {\tt timeval} structure with the current
  97. time.  The structure is defined as follows:
  98. \begin{verbatim}
  99.   struct timeval {
  100.     long    tv_sec;         /* seconds */
  101.     long    tv_usec;        /* and microseconds */
  102.   };
  103. \end{verbatim}
  104. While the {\tt timeval} structure specifies the time to microsecond accuracy,
  105. most Unix implementations do not provide time to that accuracy.  The timer
  106. callbacks registered with {\tt glutTimerFunc} are only specified to millisecond
  107. accuracy.  Because time is not represented with a single integer, the macros
  108. below permit arithmetic and comparison operations using {\tt timeval} structures.
  109. (These macros do assume the microsecond filed of the {\tt timeval} structures
  110. are normalized between 0 and 1,000,000.)
  111.  
  112. {\tt ADD\_TIME} adds two {\tt timeval} structures together, correctly handling
  113. microsecond overflow.  This macro is used by {\tt glutTimerFunc} in {\tt glut\_event.c}
  114. to calculate the absolute time when the timer callback being registered should
  115. be called.
  116.  
  117. //code
  118. #define ADD_TIME(dest, src1, src2) { \
  119.   if(((dest).tv_usec = \
  120.     (src1).tv_usec + (src2).tv_usec) >= 1000000) { \
  121.     (dest).tv_usec -= 1000000; \
  122.     (dest).tv_sec = (src1).tv_sec + (src2).tv_sec + 1; \
  123.   } else { \
  124.     (dest).tv_sec = (src1).tv_sec + (src2).tv_sec; \
  125.     if(((dest).tv_sec >= 1) && (((dest).tv_usec <0))) { \
  126.       (dest).tv_sec --;(dest).tv_usec += 1000000; \
  127.     } \
  128.   } \
  129. }
  130. //tex
  131. \noindent
  132. {\tt TIMEDELTA} subtracts one {\tt timeval} structure from another, correctly handling
  133. microsecond underflow.  This macro is used by {\tt waitForSomething} in {\tt glut\_event.c}
  134. to determine the time between current time and the next pending timer callback to
  135. know the maximum time to block waiting for input.
  136.  
  137. //code
  138. #define TIMEDELTA(dest, src1, src2) { \
  139.   if(((dest).tv_usec = (src1).tv_usec - (src2).tv_usec) < 0) { \
  140.     (dest).tv_usec += 1000000; \
  141.     (dest).tv_sec = (src1).tv_sec - (src2).tv_sec - 1; \
  142.   } else { \
  143.      (dest).tv_sec = (src1).tv_sec - (src2).tv_sec; \
  144.   } \
  145. }
  146. //tex
  147. \noindent
  148. {\tt IS\_AFTER} determines if the first {\tt timeval} structure is temporally
  149. after the second.  This macro is used by {\tt glutTimerFunc} to order the
  150. timer callback being registered temporally on the list of timer callbacks.
  151. It is also used by {\tt waitForSomething} to determine if the next timer
  152. callback should already have been called.
  153.  
  154. //code
  155. #define IS_AFTER(t1, t2) \
  156.   (((t2).tv_sec > (t1).tv_sec) || \
  157.   (((t2).tv_sec == (t1).tv_sec) && \
  158.   ((t2).tv_usec > (t1).tv_usec)))
  159. //tex
  160. \noindent
  161. {\tt IS\_AT\_OR\_AFTER} determines if the first {\tt timeval} structure is temporally
  162. at or after the second.  This macro is used by {\tt handleTimeouts} in {\tt glut\_event.c}
  163. while traversing the timer callback list to call any timer callbacks that need to
  164. be called.
  165.  
  166. //code
  167. #define IS_AT_OR_AFTER(t1, t2) \
  168.   (((t2).tv_sec > (t1).tv_sec) || \
  169.   (((t2).tv_sec == (t1).tv_sec) && \
  170.   ((t2).tv_usec >= (t1).tv_usec)))
  171. #endif
  172. //tex
  173. \subsection{Display Mode Macros}
  174.  
  175. The {\tt GLUT\_WIND\_IS} family of macros decode GLUT's display mode to determine
  176. what frame buffer capabilities a given display mode mask requests.  These macros
  177. help {\tt \_\_glutGetVisualInfo} in {\tt glut\_win.c} determine the correct X
  178. visual to use when creating a GLUT window or when determining if the current
  179. display mode is possible.
  180.  
  181. //code
  182. #define GLUT_WIND_IS_RGB(x)         (((x) & GLUT_INDEX) == 0)
  183. #define GLUT_WIND_IS_INDEX(x)       (((x) & GLUT_INDEX) != 0)
  184. #define GLUT_WIND_IS_SINGLE(x)      (((x) & GLUT_DOUBLE) == 0)
  185. #define GLUT_WIND_IS_DOUBLE(x)      (((x) & GLUT_DOUBLE) != 0)
  186. #define GLUT_WIND_HAS_ACCUM(x)      (((x) & GLUT_ACCUM) != 0)
  187. #define GLUT_WIND_HAS_ALPHA(x)      (((x) & GLUT_ALPHA) != 0)
  188. #define GLUT_WIND_HAS_DEPTH(x)      (((x) & GLUT_DEPTH) != 0)
  189. #define GLUT_WIND_HAS_STENCIL(x)    (((x) & GLUT_STENCIL) != 0)
  190. #define GLUT_WIND_IS_MULTISAMPLE(x) (((x) & GLUT_MULTISAMPLE) != 0)
  191. #define GLUT_WIND_IS_STEREO(x)      (((x) & GLUT_STEREO) != 0)
  192. #define GLUT_WIND_IS_LUMINANCE(x)   (((x) & GLUT_LUMINANCE) != 0)
  193. //tex
  194. \subsection{Work List Management}
  195. \label{iglut_mask_bits}
  196.  
  197. GLUT services requests resulting from either events or GLUT API calls
  198. by the application.  Servicing these requests is supported (and optimized)
  199. by maintaining a {\em work list}.  The work list contains windows needing
  200. requests serviced and the work pending for each window.  The work list
  201. permits requests to be batched for more efficient execution.  For example,
  202. if several GLUT API requests will result in the updating of the X event
  203. mask, these multiple requests will be batched as a single X request to
  204. update event mask (combining all the independent update request).  Also,
  205. multiple requests to redisplay the window before the next opportunity
  206. to redraw the window will trigger only a single display callback.
  207.  
  208. The constants below are masks that are OR-ed together into a work mask
  209. maintained for each GLUT window.  Work is added to the work list by
  210. calling {\tt \_\_glutPutOnWorkList} in {\tt glut\_event.c} (see Section
  211. \ref{iglut_glut_event_c}).  The routine
  212. {\tt processWindowWorkList} also in {\tt glut\_event.c} is called to process
  213. any pending work.  Windows are removed from the work list once all
  214. their pending work has been processed.
  215.  
  216. //code
  217. #define GLUT_MAP_WORK               (1 << 0)
  218. #define GLUT_EVENT_MASK_WORK        (1 << 1)
  219. #define GLUT_REDISPLAY_WORK         (1 << 2)
  220. #define GLUT_CONFIGURE_WORK         (1 << 3)
  221. #define GLUT_COLORMAP_WORK          (1 << 4)
  222. #define GLUT_DEVICE_MASK_WORK        (1 << 5)
  223. #define GLUT_FINISH_WORK        (1 << 6)
  224. #define GLUT_DEBUG_WORK            (1 << 7)
  225. #define GLUT_DUMMY_WORK            (1 << 8)
  226. #define GLUT_FULL_SCREEN_WORK       (1 << 9)
  227. #define GLUT_OVERLAY_REDISPLAY_WORK (1 << 10)
  228. //tex
  229. \noindent
  230. {\tt GLUT\_MAP\_WORK} indicates the window needs to be shown, hidden, or
  231. iconified.  {\tt GLUT\_EVENT\_MASK\_WORK} indicates the window needs its
  232. X event mask updated.  {\tt GLUT\_REDISPLAY\_WORK} indicates the window needs
  233. to be redisplayed.  {\tt GLUT\_CONFIGURE\_WORK} indicates the size, position,
  234. or stacking order needs to be updated.  {\tt GLUT\_COLORMAP\_WORK} indicates
  235. the top-level window's ICCCM {\tt WM\_COLORMAP\_WINDOWS} property needs to
  236. be changed or removed.  {\tt GLUT\_DEVICE\_MASK\_WORK} indicates the window needs
  237. its X Input extension event mask updated.  {\tt GLUT\_FINISH\_WORK} indicates
  238. a {\tt glFinish} should be done on this window.  {\tt GLUT\_DEBUG\_WORK} indicates
  239. that OpenGL errors should be queried for the rendering context associated with
  240. this context.  {\tt GLUT\_DUMMY\_WORK} is for accounting purposes within
  241. {\tt processWindowWorkList}.
  242.  
  243. The work list facility is used throughout GLUT's implementation to efficiently
  244. handle pending work.
  245.  
  246. \subsection{Callback Prototypes}
  247.  
  248. Each possible GLUT callback function has an associated {\tt typedef} used to
  249. prototype the callback.
  250.  
  251. //dead
  252. /* GLUT callback function types */
  253. //code
  254. typedef void (*GLUTdisplayCB) (void);
  255. typedef void (*GLUTreshapeCB) (int, int);
  256. typedef void (*GLUTkeyboardCB) (unsigned char, int, int);
  257. typedef void (*GLUTmouseCB) (int, int, int, int);
  258. typedef void (*GLUTmotionCB) (int, int);
  259. typedef void (*GLUTpassiveCB) (int, int);
  260. typedef void (*GLUTentryCB) (int);
  261. typedef void (*GLUTvisibilityCB) (int);
  262. typedef void (*GLUTidleCB) (void);
  263. typedef void (*GLUTtimerCB) (int);
  264. typedef void (*GLUTmenuStateCB) (int);  /* DEPRICATED. */
  265. typedef void (*GLUTmenuStatusCB) (int, int, int);
  266. typedef void (*GLUTselectCB) (int);
  267. typedef void (*GLUTspecialCB) (int, int, int);
  268. typedef void (*GLUTspaceMotionCB) (int, int, int);
  269. typedef void (*GLUTspaceRotateCB) (int, int, int);
  270. typedef void (*GLUTspaceButtonCB) (int, int);
  271. typedef void (*GLUTdialsCB) (int, int);
  272. typedef void (*GLUTbuttonBoxCB) (int, int);
  273. typedef void (*GLUTtabletMotionCB) (int, int);
  274. typedef void (*GLUTtabletButtonCB) (int, int, int, int);
  275. //dead
  276. #ifdef SUPPORT_FORTRAN
  277. typedef void (*GLUTdisplayFCB) (void);
  278. typedef void (*GLUTreshapeFCB) (int *, int *);
  279. /* NOTE the pressed key is int, not unsigned char for Fortran! */
  280. typedef void (*GLUTkeyboardFCB) (int *, int *, int *);
  281. typedef void (*GLUTmouseFCB) (int *, int *, int *, int *);
  282. typedef void (*GLUTmotionFCB) (int *, int *);
  283. typedef void (*GLUTpassiveFCB) (int *, int *);
  284. typedef void (*GLUTentryFCB) (int *);
  285. typedef void (*GLUTvisibilityFCB) (int *);
  286. typedef void (*GLUTidleFCB) (void);
  287. typedef void (*GLUTtimerFCB) (int *);
  288. typedef void (*GLUTmenuStateFCB) (int *);  /* DEPRICATED. */
  289. typedef void (*GLUTmenuStatusFCB) (int *, int *, int *);
  290. typedef void (*GLUTselectFCB) (int *);
  291. typedef void (*GLUTspecialFCB) (int *, int *, int *);
  292. typedef void (*GLUTspaceMotionFCB) (int *, int *, int *);
  293. typedef void (*GLUTspaceRotateFCB) (int *, int *, int *);
  294. typedef void (*GLUTspaceButtonFCB) (int *, int *);
  295. typedef void (*GLUTdialsFCB) (int *, int *);
  296. typedef void (*GLUTbuttonBoxFCB) (int *, int *);
  297. typedef void (*GLUTtabletMotionFCB) (int *, int *);
  298. typedef void (*GLUTtabletButtonFCB) (int *, int *, int *, int *);
  299. #endif
  300. //code
  301. //tex
  302. \subsection{Internal Data Objects}
  303.  
  304. The three major types of data objects internal to GLUT are the windows,
  305. menus, and colormaps.  Windows also have an associated overlay object when
  306. an overlay is established.
  307. Each menu object has an associated list of menu
  308. item objects.  Each color index (but not RGBA) window colormap has an associated
  309. array of color cell objects.
  310.  
  311. \subsubsection{Colormaps}
  312.  
  313. The {\tt GLUTcolormap} object maintains a colormap for color index GLUT
  314. windows.  A {\tt GLUTcolormap} is not needed for RGBA GLUT windows because such
  315. windows have constant, read-only colormaps.  GLUT attempts to share
  316. RGB X colormaps for RGBA GLUT windows with other X applications using ICCCM
  317. conventions (and when that fails, attempts sharing between windows within
  318. the GLUT program).  Because RGB colormaps have constant entries, the GLUT
  319. window needs only the X colormap ID and needs no {\tt GLUTcolormap} to track
  320. the specific mapping of pixel values to colors.
  321.  
  322. In the case of color index windows, the window's colormap is writable, and this
  323. complicates sharing.  To be general, GLUT gives each GLUT window its
  324. own independently writable colormap, but because colormaps are generally
  325. limited by graphics hardware resources, GLUT provides a means of sharing
  326. color index colormaps.  The {\tt glutCopyColormap} routine provides
  327. a way for two GLUT windows to share (by reference) the same X colormap.
  328. The scheme still allows independently writable colormaps because GLUT
  329. will ``copy on write'' a colormap being shared by reference between multiple
  330. windows.
  331.  
  332. Each {\tt GLUTcolormap} has an associated
  333. array of {\tt GLUTcolorcell} structures maintaining red, green, and blue
  334. components for each pixel value in the colormap.
  335.  
  336. //code
  337. typedef struct _GLUTcolorcell GLUTcolorcell;
  338. struct _GLUTcolorcell {
  339.   /* GLUT_RED, GLUT_GREEN, GLUT_BLUE */
  340.   GLfloat component[3];
  341. };
  342. //tex
  343. \noindent
  344. The {\tt GLUTcolormap} has a pointer to the {\tt GLUTcolorcell} array.
  345. It also contains the X colormap ID and the specific X visual the
  346. colormap pertains to.  Because color index colormaps can be shared by
  347. reference, a reference count is maintained for the number of windows
  348. using the {\tt GLUTcolormap}.  All {\tt GLUTcolormap}s are maintained
  349. on a list to provide an initial color index colormap association for
  350. a window.  When a color index window is created,
  351. {\tt \_\_glutAssociateColormap} in {\tt glut\_cindex.c} will create the
  352. initial association.
  353.  
  354. //code
  355. typedef struct _GLUTcolormap GLUTcolormap;
  356. struct _GLUTcolormap {
  357.   Visual *visual;       /* visual of the colormap */
  358.   Colormap cmap;        /* X colormap ID */
  359.   int refcnt;           /* number of windows using colormap */
  360.   int size;             /* number of cells in colormap */
  361.   int transparent;      /* transparent pixel, or -1 if opaque */
  362.   GLUTcolorcell *cells; /* array of cells */
  363.   GLUTcolormap *next;   /* next colormap in list */
  364. };
  365. //tex
  366. \subsubsection{Windows}
  367.  
  368. The {\tt GLUTwindow} object maintains all the state associated with
  369. a GLUT window created by {\tt glutCreateWindow} or {\tt glutCreateSubWindow}.
  370. Each created window is listed in the {\tt \_\_glutWindowList} array.
  371. Windows on this list are indexed from zero, despite the GLUT API
  372. assigning window identifiers starting at one.  Top-level windows (created
  373. by {\tt glutCreateWindow}) are distinguished from subwindows because
  374. top-level windows are created as children of the root window.  Subwindows
  375. are created as children of top-level windows or other subwindows.
  376.  
  377. //code
  378. typedef struct _GLUTwindow GLUTwindow;
  379. typedef struct _GLUToverlay GLUToverlay;
  380. struct _GLUTwindow {
  381. //tex
  382. \noindent
  383. Each {\tt GLUTwindow} contains its own zero-based index.
  384.  
  385. //code
  386.   int num;              /* small integer window id (0-based) */
  387. //tex
  388. \noindent
  389. Each {\tt GLUTwindow} maintains the underlying X objects it
  390. uses.  Every GLUT window has its own distinct X window and associated,
  391. distinct OpenGL rendering context.  The {\tt XVisualInfo*} describing
  392. the window's OpenGL frame buffer configuration is maintained. 
  393. RGBA windows maintain their X colormap in the {\tt GLUTwindow} structure;
  394. color index windows use the previously described {\tt GLUTcolormap} structure.
  395. Windows with established overlays maintain overlay information in
  396. the {\tt GLUToverlay} structure described next.
  397.  
  398. //dead
  399.   /* Window system related state. */
  400. //code
  401.   Window win;           /* X window for GLUT window */
  402.   GLXContext ctx;       /* OpenGL context GLUT glut window */
  403.   XVisualInfo *vis;     /* visual for window */
  404.   Colormap cmap;        /* RGB colormap for window; None if CI */
  405.   GLUTcolormap *colormap;  /* colormap; NULL if RGBA */
  406.   GLUToverlay *overlay; /* overlay; NULL if no overlay */
  407. //tex
  408.  
  409. Support for overlays means windows have a {\em layer in use}, either
  410. the overlay or normal plane.  To avoid checking what layer is in use
  411. when making current to GLUT windows (that may or may not have
  412. overlays), the {\tt renderWin} and {\tt renderCtx} always hold the X
  413. window ID and GLX context handle for the layer in use.  If {\tt renderWin}
  414. equals the {\tt win} field above, the normal plane is in use; otherwise,
  415. the overlay is in use.
  416.  
  417. //code
  418.   Window renderWin;     /* X window for rendering (might be
  419.                            overlay) */
  420.   GLXContext renderCtx; /* OpenGL context for rendering (might
  421.                            be overlay) */
  422. //tex
  423. \noindent
  424. GLUT tracks some per-window state like the window's width, height, map state,
  425. and visibility state.
  426.  
  427. //dead
  428.   /* GLUT settable or visible window state. */
  429. //code
  430.   int width;            /* window width in pixels */
  431.   int height;           /* window height in pixels */
  432.   int cursor;           /* cursor name */
  433.   int visState;         /* visibility state (-1 is unknown) */
  434.   int shownState;       /* if window mapped */
  435.   int entryState;       /* entry state (-1 is unknown) */
  436.   int damaged;          /* is layer damaged by expose? */
  437. //tex
  438. \noindent
  439. GLUT supports a pop-up menu bound to each of three mouse buttons (left, middle,
  440. and right).  {\tt GLUT\_MAX\_MENUS} is the number of supported buttons.  {\tt glutAttachMenu}
  441. associates a menu with a button in a specified window.  The {\tt menu} array holds
  442. this association.  Note that the association is {\em by name}.
  443.  
  444. //code
  445. #define GLUT_MAX_MENUS              3
  446.  
  447.   int menu[GLUT_MAX_MENUS];  /* attatched menu nums */
  448. //tex
  449. \noindent
  450. {\tt parent} points to the parent {\tt GLUTwindow} and is {\tt NULL}
  451. if the window is a top-level window.  {\tt children} points to a child
  452. of the window and is {\tt NULL} if the window has no children.  The
  453. {\tt siblings} field forms a linked list to the remaining child windows.
  454.  
  455. //dead
  456.   /* Window relationship state. */
  457. //code
  458.   GLUTwindow *parent;   /* parent window */
  459.   GLUTwindow *children; /* list of children */
  460.   GLUTwindow *siblings; /* list of siblings */
  461. //tex
  462. \noindent
  463. While not visible through the API, there is a fair amount of state
  464. required for implementation reasons.
  465.  
  466. //dead
  467.   /* Misc. non-API visible (hidden) state. */
  468. //code
  469.   Bool fakeSingle;      /* faking single buffer with double */
  470. //tex
  471. \noindent
  472. GLUT emulates single buffered
  473. windows if no single buffered visual can be found matching the window's
  474. display mode {\em but} a matching double buffered visual can be found.
  475. This is because GLX does not mandate the existence of single buffered
  476. visuals.  In this case, {\tt glutSwapBuffers} must be treated as
  477. non-operation and the window's OpenGL context must be set to draw into
  478. the front buffer.  {\tt fakeSingle} determines if the window emulates
  479. being single buffered.
  480.  
  481. //code
  482.   Bool forceReshape;    /* force reshape before display */
  483. //tex
  484. \noindent
  485. X only sends {\tt ConfigureNotify} events when the window is resized,
  486. but not when a window is created.  GLUT guarantees that a window's
  487. reshape callback will be triggered before the first display callback is
  488. triggered.  {\tt forceReshape} tracks whether an initial reshape callback
  489. has been triggered to ensure GLUT's expected behavior.
  490.  
  491. //code
  492.   Bool isDirect;        /* if direct context */
  493. //tex
  494. \noindent
  495. If a window's context uses direct rendering, {\tt isDirect} is {\tt True}.
  496. When {\tt False}, a {\tt glFinish} is performed (via the work list facility)
  497. to keep OpenGL commands from buffering up when indirect rendering is in
  498. use.  Otherwise, application interactivity is undermined by the latency
  499. caused by batching.
  500.  
  501. //code
  502.   long eventMask;       /* mask of X events selected for */
  503. //tex
  504. \noindent
  505. What X event should be selected for depends on what callbacks are registered.
  506. {\tt eventMask} maintains what events the window should select on.  The
  507. window's event mask is not immediately updated, but instead {\tt GLUT\_EVENT\_MASK\_WORK}
  508. is put on the work list to batch the event mask update.
  509.  
  510. //code
  511.   int buttonUses;       /* number of button uses, ref cnt */
  512. //tex
  513. \noindent
  514. Selecting mouse button up and down events is required for multiple reasons:
  515. the mouse callback, attached pop-up menus, and mouse motion tracking.  {\tt buttonUses}
  516. is a reference count of what uses are current.  {\tt ButtonPress} and {\tt ButtonRelease}
  517. events are selected for when {\tt buttonUses} is greater than zero and not selected
  518. for when zero.
  519.  
  520. //code
  521.   int tabletPos[2];     /* tablet position (-1 is invalid) */
  522. //tex
  523. \noindent
  524. Current X servers make it difficult to correctly track tablet
  525. position for two reasons.  First, tablet
  526. position events are allowed report on the changed axis.
  527. Second, the X Input extension's {\tt XDeviceStateNotifyEvent} is
  528. unimplemented in X servers through X11R6.  The GLUT tablet
  529. callbacks reports both the simultaneous X and Y tablet position.
  530. To report the combined position, GLUT tracks the last recorded simultaneous
  531. tablet position using {\tt tabletPos}.  If necessary, GLUT will poll the
  532. tablet position if only a single axis is initially returned.
  533.  
  534. //dead
  535.   /* Work list related state. */
  536. //tex
  537.  
  538. GLUT's work list facility requires per-window state to determine
  539. what work is pending for the window.  The {\tt workMask} is a
  540. bitmask containing the {\tt GLUT\_*\_WORK} mask bits (see Section \ref{iglut_mask_bits}
  541. to indicate what work is pending
  542.  
  543. //code
  544.   unsigned int workMask;  /* mask of window work to be done */
  545. //tex
  546. \noindent
  547.  
  548. Windows with work to do are linked into the work list.  {\tt
  549. prevWorkWin} is a reverse ordered list of window's on the work list.
  550. The list is started at {\tt \_\_glutWindowWorkList}.
  551.  
  552. //code
  553.   GLUTwindow *prevWorkWin;  /* link list of windows to work on */
  554. //tex
  555. \noindent
  556. The work list facility means that desired window state changes for showing,
  557. hiding, iconifying, repositioning, reshaping, and restacking the
  558. window must be recorded before the changes are actualized when the
  559. event list is processed:
  560.  
  561. //code
  562.   Bool desiredMapState; /* how to mapped window if on map work
  563.                            list */
  564.   int desiredConfMask;  /* mask of desired window configuration 
  565.                          */
  566.   int desiredX;         /* desired X location */
  567.   int desiredY;         /* desired Y location */
  568.   int desiredWidth;     /* desired window width */
  569.   int desiredHeight;    /* desired window height */
  570.   int desiredStack;     /* desired window stack */
  571. //tex
  572. \noindent
  573. Each per-window callback must have an associated {\tt GLUTwindow} field
  574. to record the currently registered routine for each callback: 
  575.  
  576. //dead
  577.   /* Callbacks */
  578. //code
  579.   GLUTdisplayCB display;  /* redraw callback */
  580.   GLUTreshapeCB reshape;  /* resize callback (width,height) */
  581.   GLUTmouseCB mouse;    /* mouse callback (button,state,x,y) */
  582.   GLUTmotionCB motion;  /* motion callback (x,y) */
  583.   GLUTpassiveCB passive;  /* passive motion callback (x,y) */
  584.   GLUTentryCB entry;    /* window entry/exit callback (state) */
  585.   GLUTkeyboardCB keyboard;  /* keyboard callback (ASCII,x,y) */
  586.   GLUTvisibilityCB visibility;  /* visibility callback */
  587.   GLUTspecialCB special;  /* special key callback */
  588.   GLUTbuttonBoxCB buttonBox;  /* button box callback */
  589.   GLUTdialsCB dials;    /* dials callback */
  590.   GLUTspaceMotionCB spaceMotion;  /* Spaceball motion callback */
  591.   GLUTspaceRotateCB spaceRotate;  /* Spaceball rotate callback */
  592.   GLUTspaceButtonCB spaceButton;  /* Spaceball button callback */
  593.   GLUTtabletMotionCB tabletMotion;  /* tablet motion callback */
  594.   GLUTtabletButtonCB tabletButton;  /* tablet button callback */
  595. //dead
  596. #ifdef SUPPORT_FORTRAN
  597.   /* Special Fortran display callback unneeded since no
  598.      parameters! */
  599.   GLUTreshapeFCB freshape;  /* Fortran reshape callback */
  600.   GLUTmouseFCB fmouse;  /* Fortran mouse callback */
  601.   GLUTmotionFCB fmotion;  /* Fortran motion callback */
  602.   GLUTpassiveFCB fpassive;  /* Fortran passive callback */
  603.   GLUTentryFCB fentry;  /* Fortran entry callback */
  604.   GLUTkeyboardFCB fkeyboard;  /* Fortran keyboard callback */
  605.   GLUTvisibilityFCB fvisibility;  /* Fortran visibility
  606.                                      callback */
  607.   GLUTspecialFCB fspecial;  /* special key callback */
  608.   GLUTbuttonBoxFCB fbuttonBox;  /* button box callback */
  609.   GLUTdialsFCB fdials;  /* dials callback */
  610.   GLUTspaceMotionFCB fspaceMotion;  /* Spaceball motion
  611.                                        callback */
  612.   GLUTspaceRotateFCB fspaceRotate;  /* Spaceball rotate
  613.                                        callback */
  614.   GLUTspaceButtonFCB fspaceButton;  /* Spaceball button
  615.                                        callback */
  616.   GLUTtabletMotionFCB ftabletMotion;  /* tablet motion callback 
  617.  
  618.                                        */
  619.   GLUTtabletButtonFCB ftabletButton;  /* tablet button callback 
  620.  
  621.                                        */
  622. #endif
  623. //code
  624. };
  625. //tex
  626. \subsubsection{Overlays}
  627.  
  628. When an overlay is established for a window, the window gets an associated
  629. {\tt GLUToverlay} structure.  
  630.  
  631. //code
  632. struct _GLUToverlay {
  633.   Window win;
  634.   GLXContext ctx;
  635.   XVisualInfo *vis;     /* visual for window */
  636.   Colormap cmap;        /* RGB colormap for window; None if CI */
  637.   GLUTcolormap *colormap;  /* colormap; NULL if RGBA */
  638. //tex
  639.  
  640. Like the normal plane of a window, an overlay also requires an X window ID,
  641. OpenGL rendering context, visual information, an X colormap, and associated
  642. {\tt GLUTcolormap} structure.  The {\tt vis} visual information will be
  643. for an overlay visual with a transparent pixel.
  644.  
  645. //code
  646.   int shownState;       /* if overlay window mapped */
  647.   Bool fakeSingle;      /* faking single buffer with double */
  648.   Bool isDirect;        /* if direct context */
  649.   int damaged;          /* is layer damaged by expose? */
  650. //tex
  651.  
  652. These fields maintain the same state they maintain in the {\tt GLUTwindow} structure,
  653. but for the overlay.
  654.  
  655. //code
  656.   int transparentPixel; /* transparent pixel value */
  657.   GLUTdisplayCB display;  /* redraw callback */
  658. //dead
  659.   /* Special Fortran display callback unneeded since no
  660.      parameters! */
  661. //code
  662. };
  663. //tex
  664.  
  665. A small amount of overlay specific state is maintained.  Overlays have a {\tt transparentPixel}
  666. containing the transparent pixel of their overlay.  Also, overlays can have a separate,
  667. distinct display callback for redisplaying the overlay.
  668.  
  669. Overlays can be established and removed repeatedly with {\tt glutEstablishOverlay}
  670. and {\tt glutRemoveOverlay}.  Removing the overlay destroys the associated X window
  671. and GLX context.  However, yet to be processed input events could still arrive
  672. intended for the removed overlay's X window ID.  These input events should not
  673. simply be discarded because they were generated at the inopportune time that
  674. the overlay was being removed.
  675.  
  676. GLUT maintains a {\em stale window list}.  When an overlay X window ID is destroyed,
  677. it is put on the stale window list.  When any event input arrives, all the active normal
  678. and overlay X window IDs will be searched, but if the event's X window ID is not
  679. found, the stale window list is searched.  A ``stale'' X input event destined for
  680. a removed overlay window can still be directed to the correct GLUT window by
  681. {\tt \_\_glutGetWindow}.  When a {\tt DestroyNotify} event is delivered
  682. for the overlay window ID, no more events will be received for the
  683. window ID and the ID is safely removed from the stale window list.  The
  684. stale window list is a linked list started at {\tt
  685. \_\_glutStaleWindowList}.
  686.  
  687. //code
  688. typedef struct _GLUTstale GLUTstale;
  689. struct _GLUTstale {
  690.   GLUTwindow *window;
  691.   Window win;
  692.   GLUTstale *next;
  693. };
  694.  
  695. extern GLUTstale *__glutStaleWindowList;
  696. //tex
  697.  
  698. There are some X events that need to be delivered to both overlay and
  699. normal plane X windows.  The {\tt GLUT\_OVERLAY\_EVENT\_FILTER\_MASK}
  700. lists the event masks for these events.  The event mask used to select for
  701. on an overlay window events is the normal plane window's event mask
  702. bitwise AND-ed with the {\tt GLUT\_OVERLAY\_EVENT\_FILTER\_MASK}.
  703.  
  704. //code
  705. #define GLUT_OVERLAY_EVENT_FILTER_MASK \
  706.   (ExposureMask | \
  707.   StructureNotifyMask | \
  708.   EnterWindowMask | \
  709.   LeaveWindowMask)
  710. //tex
  711.  
  712. A second event mask is the {\tt GLUT\_DONT\_PROPAGATE\_FILTER\_MASK} that
  713. lists input events that should not propagate to ancestor windows.  GLUT
  714. specifies that input event should be delivered only to the window
  715. receiving the event which is what every X window's {\em do not propagate} mask assures.
  716. By bitwise AND-ing this mask with the window's event mask, the window's
  717. {\em do not propagate} mask is calculated.
  718.  
  719. //code
  720. #define GLUT_DONT_PROPAGATE_FILTER_MASK \
  721.   (ButtonReleaseMask | \
  722.   ButtonPressMask | \
  723.   KeyPressMask | \
  724.   KeyReleaseMask | \
  725.   PointerMotionMask | \
  726.   Button1MotionMask | \
  727.   Button2MotionMask | \
  728.   Button3MotionMask)
  729. //dead
  730. #define GLUT_HACK_STOP_PROPAGATE_MASK \
  731.   (KeyPressMask | \
  732.   KeyReleaseMask)
  733. //tex
  734. \subsubsection{Menus}
  735.  
  736. GLUT's pop-up menus can be attached by name to buttons for each window.  A menu
  737. is represented by the {\tt GLUTmenu} object.  Each menu has a number
  738. of menu items, each represented by a {\tt GLUTmenuItem} structure.
  739. Each created menu is listed in the \_\_glutMenuList array index by its menu
  740. identifier.  Menus on this list are indexed from zero, despite the GLUT
  741. API assigning menu identifiers starting at one.
  742.  
  743. //code
  744. typedef struct _GLUTmenu GLUTmenu;
  745. typedef struct _GLUTmenuItem GLUTmenuItem;
  746. struct _GLUTmenu {
  747.   int id;               /* small integer menu id (0-based) */
  748. //tex
  749.  
  750. Each menu contains its own zero-based index 
  751.  
  752. //code
  753.   Window win;           /* X window for the menu */
  754. //tex
  755.  
  756. Even menu has an X window ID used to display the menu.  This window is
  757. only mapped when the menu is popped-up.  If overlays are supported, this
  758. window will use an overlay.
  759.  
  760. //code
  761.   GLUTselectCB select;  /* callback function of menu */
  762. //tex
  763.  
  764. Each menu has a single callback established when {\tt glutCreateMenu} is called.
  765.  
  766. //code
  767.   GLUTmenuItem *list;   /* list of menu entries */
  768.   int num;              /* number of entries */
  769.   Bool managed;         /* are the InputOnly windows size
  770.                            validated? */
  771.   int pixwidth;         /* width of menu in pixels */
  772.   int pixheight;        /* height of menu in pixels */
  773.   int submenus;         /* number of submenu entries */
  774. //tex
  775.  
  776. Each menu has a linked list of {\tt GLUTmenuItem} structures.  The {\tt num}
  777. field tells how many entries the menu currently has.  The {\tt managed}
  778. field is set {\tt False} whenever the menu window's size need to be
  779. updated.  Examples include when a new entry is added, an existing entry is
  780. removed, or the width of an entry changes.  {\tt pixwidth} and {\tt pixheight}
  781. keep tracks of the menu's managed size.  The number of submenus needs to
  782. be tracked because the ``trigger arrow'' adds extra width to the menu
  783. when it needs to be displayed.
  784.  
  785. //code
  786.   GLUTmenuItem *highlighted;  /* pointer to highlighted menu
  787.                                  entry, NULL not highlighted */
  788.   GLUTmenu *cascade;    /* currently cascading this menu  */
  789.   GLUTmenuItem *anchor; /* currently anchored to this entry */
  790.   int x;                /* current x origin relative to the
  791.                            root window */
  792.   int y;                /* current y origin relative to the
  793.                            root window */
  794. //dead
  795. #ifdef SUPPORT_FORTRAN
  796.   GLUTselectFCB fselect;  /* callback function of menu */
  797. #endif
  798. //code
  799. };
  800. //tex
  801.  
  802. These last fields are used when the menu is displayed.  They
  803. track if an entry is highlighted, and if so what it is, what parent
  804. menu is cascading this menu; the menu currently anchored to (that is,
  805. cascading from), and the position of the menu.
  806.  
  807. Every menu item has an {\tt InputOnly} X window.  The menu item's
  808. appearance is actually rendered into the menu's X window.  Having
  809. an {\tt InputOnly} window for the menu item allows menu item
  810. selection to be performed more efficiently.
  811.  
  812. Every menu item has an associated {\tt GLUTmenu} structure it belongs
  813.  
  814. //code
  815. struct _GLUTmenuItem {
  816.   Window win;           /* InputOnly X window for entry */
  817.   GLUTmenu *menu;       /* menu entry belongs to */
  818.   Bool isTrigger;       /* is a submenu trigger? */
  819.   int value;            /* value to return for selecting this
  820.                            entry; doubles as submenu id
  821.                            (0-base) if submenu trigger */
  822. //tex
  823.  
  824. The {\tt isTrigger} boolean tells whether the menu is a submenu trigger
  825. established by {\tt glutAddSubMenu} or {\tt glutChangeToSubMenu} or
  826. a menu entry established by {\tt glutAddMenuEntry} or {\tt glutChangeToMenuEntry}.
  827. The {\tt value} field is overloaded to be the value passed to the menu
  828. callback if the entry is selected or the menu number of the submenu
  829. the trigger cascades.
  830.  
  831. //code
  832.   char *label;          /* strdup'ed label string */
  833.   int len;              /* length of label string */
  834.   int pixwidth;         /* width of X window in pixels */
  835. //tex
  836.  
  837. The {\tt label} field contains the string displayed by the menu item
  838. with {\tt len} being the string's length in characters and
  839. {\tt pixwidth} being the strings width in pixels.  The {\tt pixwidth}
  840. speeds recalculation of the menu's width when the menu needs to
  841. be re-managed.
  842.  
  843. All the menu items for a menu are on a linked list.  The list is
  844. ordered starting with bottom items with top items at the end.
  845.  
  846. //code
  847.   GLUTmenuItem *next;   /* next menu entry on list for menu */
  848. };
  849. //tex
  850.  
  851. \subsubsection{Timers}
  852.  
  853. Each timer callback registered with {\tt glutTimerFunc} has an associated
  854. {\tt GLUTtimer} structure.  All outstanding timer callbacks are listed
  855. on the {\tt \_\_glutTimerList} linked list.  The list is sorted by time
  856. when the callback is to be called.  Timer callbacks to be called sooner
  857. are nearer the front of the list.
  858.  
  859. //code
  860. typedef struct _GLUTtimer GLUTtimer;
  861. struct _GLUTtimer {
  862.   GLUTtimer *next;      /* list of timers */
  863.   struct timeval timeout;  /* time to be called */
  864. //tex
  865.  
  866. When the timer callback is due to be called, the callback's {\tt func}
  867. callback function is called, passing {\tt value} to the callback.
  868.  
  869. //code
  870.   GLUTtimerCB func;     /* timer callback (value) */
  871.   int value;            /* callback return value */
  872. //dead
  873. #ifdef SUPPORT_FORTRAN
  874.   GLUTtimerFCB ffunc;   /* Fortran timer callback */
  875. #endif
  876. //code
  877. };
  878. //tex
  879.  
  880. \subsubsection{Event Parser}
  881.  
  882. GLUT supports the X Input extension to obtain input from tablet, dial
  883. \& button box, and Spaceball devices.  Since most GLUT programs do not
  884. use these devices, the GLUT code associated with these devices should
  885. only linked with if programs request callbacks for these devices.
  886.  
  887. GLUT provides an {\em event parser} mechanism that lets X events not
  888. understood by GLUT's basic event loop be passed on to a set of routines
  889. for processing other types of X events.  The X Input extension events
  890. can be handled this way.  The GLUT routines to register tablet, dial
  891. \& button box, and Spaceball callbacks also add an event parser for X
  892. Input extension events.  Because the X Input extension event handler is
  893. dynamically made a part of GLUT's main loop through the event parser
  894. mechanism, only programs that use the tablet, dial
  895. \& button box, and Spaceball callbacks require GLUT and X Input
  896. extension code.
  897.  
  898. //code
  899. typedef struct _GLUTeventParser GLUTeventParser;
  900. struct _GLUTeventParser {
  901.   int (*func) (XEvent *);
  902.   GLUTeventParser *next;
  903. };
  904. //tex
  905.  
  906. The event parser list itself is a linked list of function pointers
  907. taking an {\tt XEvent*} as a parameter.  Event parsers are registered
  908. with {\tt \_\_glutRegisterEventParser}.
  909.  
  910. //dead
  911. /* Declarations to implement glutFullScreen support with
  912.    mwm/4Dwm. */
  913.  
  914. /* The following X property format is defined in Motif 1.1's
  915.    Xm/MwmUtils.h, but GLUT should not depend on that header
  916.    file. Note: Motif 1.2 expanded this structure with
  917.    uninteresting fields (to GLUT) so just stick with the
  918.    smaller Motif 1.1 structure. */
  919. //tex
  920.  
  921. To implement {\tt glutFullScreen}, the window manager needs to be
  922. informed that it should not decorate or add borders to the GLUT window
  923. covering the screen.  For the Motif window manager, this is done by
  924. placing a special property on the top-level window to be made full
  925. size.  The {\tt MotifWmHints} structure below encodes the format of
  926. the property.
  927.  
  928. //code
  929. typedef struct {
  930. #define MWM_HINTS_DECORATIONS   2
  931.   long flags;
  932.   long functions;
  933.   long decorations;
  934.   long input_mode;
  935. } MotifWmHints;
  936. //tex
  937.  
  938. The remainder of {\tt glutint.h} is declarations for variables and
  939. functions used internal to GLUT's implementation.  These variables and
  940. functions will be discussed as they are introduced within GLUT's
  941. source code.
  942.  
  943. //dead
  944. /* private variables from glut_event.c */
  945. extern GLUTwindow *__glutWindowWorkList;
  946. extern int __glutWindowDamaged;
  947. #ifdef SUPPORT_FORTRAN
  948. extern GLUTtimer *__glutTimerList;
  949. extern GLUTtimer *__glutNewTimer;
  950. #endif
  951.  
  952. /* private variables from glut_init.c */
  953. extern Atom __glutWMDeleteWindow;
  954. extern Display *__glutDisplay;
  955. extern unsigned int __glutDisplayMode;
  956. extern GLboolean __glutDebug;
  957. extern GLboolean __glutForceDirect;
  958. extern GLboolean __glutIconic;
  959. extern GLboolean __glutTryDirect;
  960. extern Window __glutRoot;
  961. extern XSizeHints __glutSizeHints;
  962. extern char **__glutArgv;
  963. extern char *__glutProgramName;
  964. extern int __glutArgc;
  965. extern int __glutConnectionFD;
  966. extern int __glutInitHeight;
  967. extern int __glutInitWidth;
  968. extern int __glutInitX;
  969. extern int __glutInitY;
  970. extern int __glutScreen;
  971. extern int __glutScreenHeight;
  972. extern int __glutScreenWidth;
  973. extern Atom __glutMotifHints;
  974. extern unsigned int __glutModifierMask;
  975.  
  976. /* private variables from glut_menu.c */
  977. extern GLUTmenu *__glutCurrentMenu;
  978. extern GLUTmenuItem *__glutItemSelected;
  979. extern GLUTmenu *__glutMappedMenu;
  980. extern GLUTwindow *__glutMenuWindow;
  981. extern void (*__glutMenuStatusFunc) (int, int, int);
  982.  
  983. /* private variables from glut_win.c */
  984. extern GLUTwindow **__glutWindowList;
  985. extern GLUTwindow *__glutCurrentWindow;
  986. extern int __glutWindowListSize;
  987. extern void (*__glutFreeOverlayFunc) (GLUToverlay *);
  988.  
  989. /* private routines from glut_cindex.c */
  990. extern GLUTcolormap *__glutAssociateColormap(XVisualInfo * vis);
  991. extern void __glutFreeColormap(GLUTcolormap *);
  992.  
  993. /* private routines from glut_event.c */
  994. extern void (*__glutUpdateInputDeviceMaskFunc) (GLUTwindow *);
  995. extern void __glutPutOnWorkList(GLUTwindow * window,
  996.   int work_mask);
  997. extern void __glutRegisterEventParser(GLUTeventParser * parser);
  998. extern void __glutPostRedisplay(GLUTwindow * window, int layerMask);
  999.  
  1000. /* private routines from glut_init.c */
  1001. extern void __glutOpenXConnection(char *display);
  1002. extern void __glutInitTime(struct timeval *beginning);
  1003.  
  1004. /* private routines for glut_menu.c */
  1005. extern GLUTmenu *__glutGetMenu(Window win);
  1006. extern GLUTmenu *__glutGetMenuByNum(int menunum);
  1007. extern GLUTmenuItem *__glutGetMenuItem(GLUTmenu * menu,
  1008.   Window win, int *which);
  1009. extern void __glutFinishMenu(Window win, int x, int y);
  1010. extern void __glutMenuItemEnterOrLeave(GLUTmenuItem * item,
  1011.   int num, int type);
  1012. extern void __glutPaintMenu(GLUTmenu * menu);
  1013. extern void __glutSetMenu(GLUTmenu * menu);
  1014. extern void __glutStartMenu(GLUTmenu * menu,
  1015.   GLUTwindow * window, int x, int y, int x_win, int y_win);
  1016.  
  1017. /* private routines from glut_util.c */
  1018. extern void __glutWarning(char *format,...);
  1019. extern void __glutFatalError(char *format,...);
  1020. extern void __glutFatalUsage(char *format,...);
  1021.  
  1022. /* private routines from glut_win.c */
  1023. extern GLUTwindow *__glutGetWindow(Window win);
  1024. extern GLUTwindow *__glutToplevelOf(GLUTwindow * window);
  1025. extern void __glutChangeWindowEventMask(long mask, Bool add);
  1026. extern void __glutEstablishColormapsProperty(
  1027.   GLUTwindow * window);
  1028. extern XVisualInfo *__glutDetermineVisual(
  1029.   unsigned int mode,
  1030.   Bool * fakeSingle,
  1031.   XVisualInfo * (getVisualInfo) (unsigned int));
  1032. extern XVisualInfo *__glutGetVisualInfo(unsigned int mode);
  1033. extern void __glutSetWindow(GLUTwindow * window);
  1034. extern void __glutReshapeFunc(GLUTreshapeCB reshapeFunc,
  1035.   int callingConvention);
  1036. extern void __glutDefaultReshape(int, int);
  1037. extern void __glutSetupColormap(
  1038.   XVisualInfo * vi,
  1039.   GLUTcolormap ** colormap,
  1040.   Colormap * cmap);
  1041.  
  1042. /* private routines from glut_ext.c */
  1043. extern int __glutIsSupportedByGLX(char *);
  1044.  
  1045. /* private routines from glut_input.c */
  1046. extern void __glutUpdateInputDeviceMask(GLUTwindow * window);
  1047.  
  1048. #endif /* __glutint_h__ */
  1049.